import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Properties;

public class Base {
    public Base(){
        try{
            Method[] ms=this.getClass().getMethods();
            Properties pro=new Properties();
            pro.load(Base.class.getClassLoader().getResourceAsStream("beans.properties"));
            for(Method m:ms){
                if (m.isAnnotationPresent(Inject.class)){
                    String mname=m.getName();
                    mname=mname.substring(3);
                    mname=mname.substring(0,1).toLowerCase()+mname.substring(1);
                    System.out.println(mname);
                    String cname=(String) pro.get(mname);
                    Object o=Class.forName(cname).newInstance();
                    m.invoke(this, o);
                }
            }
        }catch (IOException E){
            E.printStackTrace();
        } catch (InstantiationException e){
            e.printStackTrace();
        }catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
}

